/**
 * 
 */
package server.user;

import java.util.LinkedList;
import java.util.List;

/**
 * Class representing a single user
 * 
 * @author Kamil Nowak
 * 
 */
public class User {

	private String login;
	private Long connectionId;
	private UserState state = UserState.FREE;
	private List<Long> rooms = new LinkedList<Long>();
	
	/**
	 * 
	 */
	public User() {}

	/**
	 * Creates user with given login and connectionId. 
	 * 
	 * @param login
	 * @param connectionId
	 */
	public User(String login, Long connectionId) {
		super();
		this.connectionId = connectionId;
		this.login = login;
		
	}

	public Long getConnectionId() {
		return connectionId;
	}

	public String getLogin() {
		return login;
	}

	public UserState getState() {
		return state;
	}

	public void setState(UserState state) {
		this.state = state;
	}

	/**
	 * Get list of rooms user is in
	 * @return list of occupied rooms.
	 */
	public List<Long> getRooms() {
		return rooms;
	}
	
	/**
	 * Add new room to user room list.
	 * @param roomId
	 */
	public void addRoom(Long roomId) {
		rooms.add(roomId);
	}

	/**
	 * Remove room from user list.
	 * @param roomId
	 */
	public void removeRoom(Long roomId) {
		rooms.remove(roomId);
	}
	
	
}
